package com.neusoft.mapper;

import com.neusoft.domain.Cart;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CartDao {
    @Select("select * from cart where userId = #{userId}")
    List<Cart> listCart(Cart cart);

    @Insert("insert into cart(foodId,businessId,userId,quantity) values(#{foodId},#{businessId},#{userId},#{quantity})")
    int saveCart(Cart cart);

    @Delete("delete from cart  where userId = #{userId} and foodId = #{foodId} and businessId = #{businessId}")
    int removeCart(Cart cart);

    @Update("update cart set quantity = #{quantity} where userId = #{userId} and foodId = #{foodId} and businessId = #{businessId}")
    int updateCart(Cart cart);
}
